package com.atguigu.gmall.feign.product;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.product.BaseCategoryView;
import com.atguigu.gmall.model.product.SkuInfo;
import com.atguigu.gmall.model.product.SpuSaleAttr;
import com.atguigu.gmall.model.to.CategoryAndChildTo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@FeignClient("service-product")
@RequestMapping("/rpc/inner/product")
public interface ProductFeignClient {


    /**
     * 获取系统的所有分类及子分类
     * @return
     */

    @GetMapping("/categorys")
    public Result<List<CategoryAndChildTo>> getAllGategoryWithChilds();

    /**
     * 获取一个sku的分类层级信息
     * @param skuId
     * @return
     */
    @GetMapping("/category/view/{skuId}")
    public Result<BaseCategoryView> getSkuCategoryView(
            @PathVariable("skuId") Long skuId);


    /**
     * 查询skuInfo信息
     * @param skuId
     * @return
     */
    @GetMapping("skuInfo/{skuId}")
    public Result<SkuInfo> getSkuInfo(@PathVariable("skuId") Long skuId);

    /**
     * 商品服务的远程查价格
     * @param skuId
     * @return
     */
    @GetMapping("skuInfo/price/{skuId}")
    public  Result<BigDecimal> getSkuPrice(@PathVariable("skuId") Long skuId);

    /**
     * 查询sku对应的spu的销售属性和值
     * @return
     */
    @GetMapping("skuInfo/sup/saleattrndvalue/{skuId}")
    public Result<List<SpuSaleAttr>> getSkuSaleAttrAndValue(@PathVariable("skuId") Long skuId);


    /**
     * 查询{"40":"106|109"
     * "41":"107|109"
     * "49":"107|109"}
     * @param skuId
     * @return
     */
    @GetMapping("/skuInfo/valuejson/{skuId}")
    public Result<Map<String,String>> getSkuValueJson(@PathVariable("skuId") Long skuId);
}
